#include "stdafx.h"
#include "simple_asyn.h"



namespace space_asio{

	//void handle_accept( io_service& service ,socket_ptr sock, ip::tcp::acceptor& acc   ,const boost::system::error_code & err );

	//void start_accept( io_service& service  ,ip::tcp::acceptor& acc ,socket_ptr sock )
	//{
	//	acc.async_accept(*sock,  boost::bind( handle_accept, service ,sock, acc, _1) );
	//}

	//void handle_accept( io_service &service ,socket_ptr sock, ip::tcp::acceptor& acc   ,const boost::system::error_code & err )
	//{
	//	if ( err) return;
	//	// at this point, you can read/write to the socket
	//	//socket_ptr sock(new ip::tcp::socket(service));
	//	start_accept(service ,acc ,sock);
	//}

	//void connect_handler( const boost::system::error_code & ec )
	//{
	//	// here we know we connected successfully
	//	// if ec indicates success  
	//	printf("connect_handler");
	//}




	//void asyc_new_server()
	//{
	//	io_service service;
	//	ip::tcp::endpoint ep( ip::tcp::v4(), 2001);
	//	ip::tcp::acceptor acc(service, ep);
	//	socket_ptr sock(new ip::tcp::socket(service));
	//	start_accept(service ,acc ,sock);
	//	service.run();
	//}

	//void asyc_new_client()
	//{
	//	io_service service;
	//	ip::tcp::endpoint ep( ip::address::from_string("127.0.0.1"), 2001);
	//	ip::tcp::socket sock(service);
	//	sock.async_connect(ep, connect_handler);
	//	service.run();
	//}



	void test_simple_asyn()
	{
		//boost::thread(asyc_new_server);
		//boost::thread(asyc_new_client);
	}

}

